<div class="header mt30">
    <div class="w1100">
        <!-- 头部主体开始 -->
        <div class="module cut">
            <div class="logo fl" onclick="location.href='index.php'"><a><img alt="" src="images/logo.jpg"
                                                                             style="height: 70px;width: 200px"
                                                                             border="0"></a></div>
            <!-- 头部搜索开始 -->
            <div class="top-search fl">
                <form method="get" action="search.php">
                    <?php
                    if (isset($_REQUEST['uid'])) {
                        ?>
                        <input type="text" style="display:none;" name="uid" value="<?php echo $_REQUEST['uid'] ?>">
                        <?php
                    }
                    ?>
                    <div class="sf cut">
                        <input class="fl" name="kw" type="text" value="" placeholder="搜索您想要的商品">
                        <button class="fr" type="submit">搜 索</button>
                    </div>
                </form>

            </div>
            <!-- 头部搜索结束 -->
            <?php
            if (isset($_SESSION['uid'])) {
                ?>
                <!-- 头部购物车开始 -->
                <div class="top-cart fr">
                    <div class="radius4 mt10">
                        <i class=""><img src="images/cart.gif" style="width: 20px"> </i>
                        <a href="user/cart.php?uid=<?php echo $_SESSION['uid'] ?>"><font>我的购物车</font></a></div>
                </div>
                <!-- 头部购物车结束 -->
                <?php
            }
            ?>

        </div>
        <!-- 头部主体结束 -->
        <div class="module mt20">
            <!-- 导航开始 -->
            <div class="nav cut">

                <div class="cross cut">
                    <ul>

                        <?php
                        if (isset($_SESSION['uid'])) {
                            $uid = $_SESSION['uid'];
                            $isAdmin = false;
                            if($uid == 'admin')
                                $isAdmin = true;
                            // echo $_SESSION['uid'.$uid];
                            // exit;
                            $flag = 1;
                            ?>
                            <li><a href="index.php?uid=<?php echo $uid ?>">首页</a></li>
                            <li><a href="center.php?uid=<?php echo $uid ?>"><?php if($isAdmin) echo '管理中心'; else echo '个人中心'?></a></li>

                            <li><a onclick="logout()">退出登录</a></li>
                            <li><a href="message-board.php">联系我们</a></li>
                            <?php


                        } else {
                            ?>
                            <li><a href="index.php">首页</a></li>
                            <li><a href="user/login.php">用户登录</a></li>
                            <li><a href="message-board.php">联系我们</a></li>
                            <?php
                        }
                        ?>

                    </ul>
                </div>
            </div>
            <!-- 导航结束 -->
        </div>
    </div>
</div>
<script>
    function logout() {
        if (confirm('是否退出登录？'))
            location.href = './user/logout.php';
    }
</script>